import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

export default defineConfig({
  base: '/',
  server: {
    host: '0.0.0.0',
    port: '3333',
    proxy: {
      '/API': {
        target: 'http://dev.hua-v.com:12348/mes/api',
        //target: 'http://dev.yunkeruida.top:8090/tong/api/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/API/, ''), //api替换为'',
      },
    },
  },
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue', 'vue-router', 'pinia'],
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': '/src',
    },
  },
  build: {
    target: 'esnext',
    outDir: 'dist',
    chunkSizeWarningLimit:24000
  },
})
